package lesson19.notepad;

public class Page {

	private String title;
	private String text = "";
	
	Page(String title)
	{
		if (title == null)
		{
			System.out.println("Wrong title format! Please restart the app!");
		}else{
			this.title = title;
		}
	}
	
	void addText(final String addedText)
	{
		if (addedText != null)
			this.text = this.text + "\n" + (addedText);
		else
			System.out.println("Wrong text format! Please restart the app!");
	}
	
	void deleteText()
	{
		this.text = "";
	}
	
	void printPageInfo()
	{
		System.out.println("Title: Page " + this.title);
		System.out.println("Text: " + this.text);
	}
	
	public boolean equals(Object obj)
	{
		if( obj instanceof Page)
		{
			return ((Page) obj).title.equals(this.title);
		}else
			return false;
	}
   
   // modification from the server
	
}
